package com.demo.mybatis.enumhandle;

import com.baomidou.mybatisplus.autoconfigure.MybatisPlusProperties;
import com.baomidou.mybatisplus.autoconfigure.MybatisPlusPropertiesCustomizer;
import com.demo.mybatis.enumhandle.support.DictHandler;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class MybatisPlusAutoConfiguration {

    @Bean
    public MybatisPlusPropertiesCustomizer mybatisPlusPropertiesCustomizer() {
        return properties -> {
            properties.getGlobalConfig().setBanner(false);
            if (properties.getConfiguration() == null) {
                properties.setConfiguration(new MybatisPlusProperties.CoreConfiguration());
            }
            properties.getConfiguration().setDefaultEnumTypeHandler(DictHandler.class);
        };
    }

}
